package com.qidianit.mes.pro.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qidianit.mes.pojo.Result;
import com.qidianit.mes.pojo.pro.BomRelation;
import com.qidianit.mes.pro.mapper.BomRelationMapper;
import com.qidianit.mes.pro.service.BomRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: YKYB
 * @Date: 2025/9/25 17:07
 * @Description:
 */
@Service
public class BomRelationServiceImpl implements BomRelationService {

    @Autowired
    private BomRelationMapper bomRelationMapper;

    @Override
    public Result<BomRelation> selectList(Long parentId, Integer pageNum, Integer pageSize) {
        //开启分页
        PageHelper.startPage(pageNum, pageSize);
        List<BomRelation> list = bomRelationMapper.selectList(parentId);
        PageInfo<BomRelation> pageInfo = new PageInfo<>(list);
        return Result.success(pageInfo.getTotal(), pageInfo.getList());
    }
}
